﻿using System;
using Microsoft.Xna.Framework;

namespace ThreeDWorld
{
    public class Primitive
    {
        public Primitive(ContentReader reader)
        {
            Name = reader.ReadString();

            Points = new Vector3[reader.ReadInt32()];

            for (int i = 0; i != Points.Length; i++)
            {
                Points[i] = reader.ReadVector3();
            }

            Polygons = new Polygon[reader.ReadInt32()];

            for (int i = 0; i != Polygons.Length; i++)
            {
                Polygons[i] = new Polygon(reader);
            }

            Bounds = BoundingBox.CreateFromPoints(Points);
        }

        public string Name
        {
            get;
            private set;
        }

        public Vector3[] Points
        {
            get;
            private set;
        }

        public Polygon[] Polygons
        {
            get;
            private set;
        }

        public BoundingBox Bounds
        {
            get;
            private set;
        }
    }
}
